from libs.common import rand_str, get_ip, is_empty_str, success, error
from trade.models.kline import Kline

def getKline(request):
    dataJson = {}
    if request.method == 'GET':
        dataJson = request.GET

    if ('type' in dataJson) == False:
        return error('type不能为空')

    klineList = Kline.objects.filter(period=dataJson['type']).order_by("created").values()
    print(list(klineList))
    rd = {
        'data': list(klineList)
    }
    return success(**rd)